<template>
  <div class="onboarding-page">
    <!-- 欢迎区 -->
    <header class="welcome-section">
      <div class="brand-header">
        <img src="/logo.png" class="brand-logo" alt="云盘Logo">
        <h1>欢迎使用云智存</h1>
        <p>您的智能文件管理专家</p>
      </div>
    </header>

    <!-- 核心功能展示 -->
    <main class="feature-grid">
      <div v-for="(feature, index) in features" :key="index"
           class="feature-card"
           @mouseenter="activeFeature = index"
           @mouseleave="activeFeature = -1">
        <el-icon :size="40" class="feature-icon">
          <component :is="feature.icon" />
        </el-icon>
        <h3>{{ feature.title }}</h3>
        <p>{{ feature.description }}</p>
        <div class="demo-preview" v-if="activeFeature === index">
          <!-- 这里可以加入功能的演示内容 -->
        </div>
      </div>
    </main>

    <!-- 操作引导 -->
    <div class="action-guide">
      <div class="guide-step">
        <span class="step-number">1</span>
        <div class="step-content">
          <h4>拖放文件到此处上传</h4>
          <p>支持批量上传和文件夹拖拽</p>
        </div>
      </div>
      <div class="guide-step">
        <span class="step-number">2</span>
        <div class="step-content">
          <h4>点击创建协作空间</h4>
          <p>邀请团队成员共同编辑文档</p>
        </div>
      </div>
    </div>

    <!-- 底部操作 -->
    <footer class="action-footer">
      <div class="action-buttons">
        <el-button type="primary" size="large" @click="startUsing">
          立即体验
        </el-button>
        <el-button link @click="skipGuide">
          跳过引导
        </el-button>
      </div>
    </footer>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import {
  UploadFilled,
  User,
  Connection,
  FolderOpened
} from '@element-plus/icons-vue'

const activeFeature = ref(-1)

const features = [
  {
    icon: UploadFilled,
    title: '极速上传',
    description: '支持拖拽和批量上传',
  },
  {
    icon: User,
    title: '权限控制',
    description: '精细的访问权限设置',
  },
  {
    icon: Connection,
    title: '实时协作',
    description: '多人在线协同编辑',
  },
  {
    icon: FolderOpened,
    title: '智能管理',
    description: '自动分类整理文件',
  },
]

const startUsing = () => {
  // 跳转到主界面逻辑
  window.location.href = '/cloud-drive/fileManage'
}

const skipGuide = () => {
  startUsing()
}
</script>

<style scoped>
/* 整体页面样式 */
.onboarding-page {
  background-color: #f4f6f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 欢迎区样式 */
.welcome-section {
  text-align: center;
  padding: 2rem;
  background-color: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.brand-logo {
  max-width: 120px;
  margin-bottom: 1rem;
  animation: logoPulse 2s infinite ease-in-out;
}

@keyframes logoPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

h1 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 0.5rem;
}

p {
  font-size: 1.1rem;
  color: #666;
}

/* 核心功能展示样式 */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.8rem;
  padding: 2rem;
  background-color: #ffffff;
  margin: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  flex: 1;
}

.feature-card {
  background-color: #fff;
  border-radius: 10px;
  padding: 1.8rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid #f0f0f0;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border-color: #e0e0e0;
}

.feature-icon {
  margin-bottom: 1rem;
  color: #409EFF;
  transition: color 0.3s ease;
}

.feature-card:hover .feature-icon {
  color: #2d8cf0;
}

h3 {
  font-size: 1.4rem;
  color: #333;
  margin-bottom: 0.8rem;
}

/* 操作引导样式 */
.action-guide {
  padding: 2rem;
  background-color: #f9fafb;
  border-radius: 12px;
  margin: 1rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.guide-step {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.8rem;
}

.step-number {
  background-color: #409EFF;
  color: #fff;
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  margin-right: 1.2rem;
  font-weight: bold;
}

.step-content h4 {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.step-content p {
  font-size: 1rem;
  color: #666;
}

/* 底部操作样式 */
.action-footer {
  padding: 2rem;
  text-align: center;
  background-color: #ffffff;
  border-radius: 12px;
  margin: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.el-button {
  width: 200px;
}

.el-button[type="primary"] {
  background-color: #409EFF;
  border-color: #409EFF;
  font-weight: 500;
}

.el-button[type="primary"]:hover {
  background-color: #2d8cf0;
  border-color: #2d8cf0;
}

.el-button--link {
  color: #606266;
  font-weight: 500;
}

.el-button--link:hover {
  color: #409EFF;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .feature-grid {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .welcome-section {
    padding: 1.5rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  .action-guide {
    padding: 1.5rem;
  }
}
</style>